<template>
    <div>
        <div class="latest-recommed">最新推荐</div>
        <ul>
            <router-link tag="li" class="item" v-for="item of recommed" :key="item.id" :to="'./detail/'+item.id">
                <img class="item-img" :src="item.urlImg" alt="">
                <div class="item-info">
                    <p class="item-title">{{item.title}}</p>
                    <p class="item-desc">{{item.desc}}</p>
                    <button class="item-button">查看详情</button>
                </div>
            </router-link>
        </ul>
    </div>
</template>

<script>
export default {
  name: 'HomeRecommed',
  props: {
    recommed: Array
  }
}
</script>

<style scoped>
*{
    padding: 0;
    margin: 0;
}
.latest-recommed{
    font-size: 1rem;
    font-weight: 400;
    background-color: #eee;
    height: 2.4rem;
    text-align: left;
    line-height: 2.4rem;
    text-indent: 1em;
}
ul{
    margin: 0;
    padding: 0;
}
ul li{
    list-style-type: none;
}
.item{
    width: 100%;
    display: flex;
    height: 8rem;
    overflow: hidden;
    border-bottom: 1px solid #ccc;
}
.item-img{
    width: 6.6rem;
    height: 6.6rem;
    padding: .8rem;
}
.item-info{
    flex: 1;
    text-align: left;
}
.item-info{
    margin-top: 14px;
    /* 多出部分用省略号代替 */
    min-width: 0;
}
.item-title{
    font-size: 1.2em;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.item-desc{
    color: #888;
    margin: 6px 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.item-button{
    margin-top: 12px;
    background-color: rgb(243, 143, 13);
    border-radius: 6px;
    padding: 2px 10px;
    border: 1px solid rgb(243, 143, 13);
    color: #fff;
}
</style>
